package cn.com.czpb.client.module.news.activity;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.os.Bundle;

import cn.com.czpb.client.R;
import cn.com.czpb.client.app.ToolBarActivityWhite;
import cn.com.czpb.client.module.actives.HuodongFragment;
import cn.com.czpb.client.module.news.adapter.WinDowaPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class WinDowActivity extends ToolBarActivityWhite {
    @BindView(R.id.news_pager)
    ViewPager newsPager;
    @BindView(R.id.tablayout_id)
    TabLayout tablayoutId;
    private WinDowaPagerAdapter adapter;
    private List<Fragment> list;
    @Override
    public int setMyContentView() {
        return R.layout.activity_win_dow;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
    }
    private void init(){
        list = new ArrayList<>();
        adapter = new WinDowaPagerAdapter(getSupportFragmentManager(), list, activity);
        newsPager.setAdapter(adapter);
        tablayoutId.setSelectedTabIndicatorColor(getResources().getColor(R.color.color_df3031));


//        tablayoutId.setTabMode(TabLayout.MODE_FIXED);

        for (int i = 0; i < 4; i++) {
            HuodongFragment fragment=HuodongFragment.newInstance();
            list.add(fragment);
        }
        tablayoutId.setupWithViewPager(newsPager);
    }
}
